<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [1, 3, 5, 7, 8, 9,];
        // 1. 直接遍历
        //console.log(arr[0]); 

        // 2. for 循环
       /*  for (var i = 0; i < arr.length; i++) {
            console.log(arr[i], i, arr);
        } */
        // 3. 普通函数封装
        function eact(array,fun) {
            for (var i = 0; i < array.length; i++) {
                console.log(array[i], i, arr);
                fun(arr[i],i,arr);
            }
        }
        // 希望在函数被调用时获取这个值，并在调用时可以作出处理
        eact(arr, function () {
            console.log('------------',a,b,c);
        })
       /*  var arr1 = ['a', 'b', 'c'];
        each(arr1, function () {

        }) */


        function a(){
            console.log("aaa");
        }
        function b(){
            console.log("bbbb");
        }
    </script>
</body>

</html>